<div class="row">
	<div class="col-xs-12 col-sm-12 col-md-12 col-lg-4">
		<h1 class="page-title txt-color-blueDark"><i class="fa-fw fa fa-wrench"></i> {:W('Nav/navTop')}>
	   		<if condition="I('cookie.think_language')=='zh-cn' ">
	    	{$rel[name]}
		    <else /> 
		    {$rel[en_name]}
		    </if>
		</h1>
	</div>
	</div>
	<div class="row">
	<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
	<!-- NEW WIDGET START -->
						<article class="col-sm-12 col-md-12 col-lg-12">
									<div class="jarviswidget jarviswidget-color-blue" id="wid-id-1" data-widget-editbutton="false">
								<!-- widget options:
								usage: <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false">
				
								data-widget-colorbutton="false"
								data-widget-editbutton="false"
								data-widget-togglebutton="false"
								data-widget-deletebutton="false"
								data-widget-fullscreenbutton="false"
								data-widget-custombutton="false"
								data-widget-collapsed="true"
								data-widget-sortable="false"
				
								-->
								<header>
									<span class="widget-icon"> <i class="fa fa-sitemap"></i> </span>
									<h2>{:L('role_permissions_edit')}</h2>
				
								</header>
				
								<!-- widget div-->
								<div class="widget-body">
								
									<!-- widget content -->
									<form action="{:U('Role/rolePriv')}&id={:I('get.id')}" id="role-form" role="form" method="post" class="smart-form">
								
										<div class="tree smart-form">
											<ul>
												<li>
													<span><i class="fa fa-lg fa-list"></i>&nbsp;{:L('cms_name')}</span>
											<ul>
											{$html}
											</ul>
											</li>
											</ul>
										</div>
										<footer>
								<section class="col-sm-12 col-md-12 col-lg-12">
								<input type="hidden" name="dosubmit" value='1'/>
								<button type="submit" class="btn btn-primary">
									{:L('cms_submit')}
								</button>
								</section>	
								</footer>
							</form>
									</div>
									<!-- end widget content -->
				
						</article>
						<!-- WIDGET END -->
					</div>
					</div>
			
<!-- end row -->

<script>
$(document).ready(function() {
	
	$('#role-form').ajaxForm(function(data) { 
		if(data.status==200){
       	 	showhidetip(data.msg,2);
       	 window.location.href="#{$Think.config.SUB_PATH}index.php?m=admin&c=role&a=index";return false;
       	}else if(data){
       		showhidetip(data.msg,2);return false;
       	}else{
       		showhidetip("{:L('cms_other_error')}",2);return false;
       	}
	});
});
$(document).ready(function() {
	
	
	// PAGE RELATED SCRIPTS

	$('.tree > ul').attr('role', 'tree').find('ul').attr('role', 'group');
	$('.tree').find('li:has(ul)').addClass('parent_li').attr('role', 'treeitem').find(' > span').on('click', function(e) {
		var children = $(this).parent('li.parent_li').find(' > ul > li');
		if (children.is(':visible')) {
			children.hide('fast');
			$(this).parent('li.parent_li').find(' > i').removeClass().addClass('fa fa-lg fa-plus-circle');
		} else {
			children.show('fast');
			$(this).parent('li.parent_li').find(' > i').removeClass().addClass('fa fa-lg fa-minus-circle');
		}
		e.stopPropagation();
	});			

})
//$('#role_box_2').attr("checked",'checked');

$(".checkbox").click(function(event){
	event.stopPropagation();
});

function check_box_role(id){
	event = $('#role_box_'+id);
	if(event.attr("checked")){
		event.removeAttr("checked");
		$(".checked_"+id).find('input').removeAttr("checked");
		//$(".checked_"+id).find('i').css('opacity',0);
	}else{
		event.attr("checked",'true');
		$(".checked_"+id).find('input').attr("checked",true);
		//$(".checked_"+id).find('i').css('opacity',1);

	}
	
}
</script>